Apparatus, method and program for three-dimensional-shape detection

ABSTRACT

The present invention relates to three-dimensional shape detection. In the present invention, a plurality of types of pattern lights formed of a series of alternate light and dark patterns are projected onto an object in a time series, an image of the object onto which each pattern light is projected is taken, a plurality of luminance images are generated, a code image having certain codes assigned to the pixels is generated in accordance with a result of threshold processing of the plurality of luminance images with respect to a certain threshold; and the three-dimensional shape of the object is calculated. Further, in the invention, a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest is detected, in a detection position in a direction crossing the pattern light in the code image, a luminance image having a light-dark boundary in a position corresponding to the first pixel is extracted, from the plurality of luminance images, a pixel area that includes a pixel in a certain area adjacent to the first pixel is determined, an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area is calculated, a position having a certain luminance threshold in the approximate expression and detecting the boundary coordinates of the code of interest in accordance with the result of calculation is calculated, and the three-dimensional shape of the object is calculated in accordance with the boundary coordinates detected by the boundary coordinate detection unit by using the code image.

BACKGROUND

1. Technical Field

The present invention relates to three-dimensional-shape detection apparatuses, three-dimensional-shape detection methods, and three-dimensional-shape detection programs that can detect the boundary of pattern light with sub-pixel precision at high speed without increasing the number of images of the pattern light.

2. Related Art

A commonly-known three-dimensional -shape detection apparatus detects a three-dimensional shape of a target object by using a slit-light projection method, in which one slit light is projected onto the target object successively, an imaging means inputs an image in each direction φ of the projected light, and the position of the target object is detected by obtaining a direction θ of viewing the target object from the imaging means based on the path of the slit light in the image.

In the slit-light projection method, however, the resolution depends on the number of slits, and one video frame is required to obtain a single slit image. Obtaining an image of many slits takes a long time.

As a resolution of the problem, a so-called space code method is proposed in Kosuke Sato, et al. “Distance Image Input by Space Code,” Transactions of the Institute of Electronics and Communication Engineers of Japan, 85/3 Vol. J68-D No. 3, pp. 369-375 (Document 1). In the space code method, n vertically-striped pattern lights are projected onto the target object, and the space is divided into 2n narrow fan-shaped areas. An n-bit binary code (space code) can be assigned to each area, and an image equivalent to a 2n slit image can be obtained by n times of pattern-light projection. Accordingly, the measurement can be made faster, in comparison with the slit-light projection method.

The finite division of the pattern light and the resolution of the imaging element lead to an error in the boundary of the detected pattern light, consequently disabling high-precision detection of the three-dimensional shape of the target object.

A three-dimensional-shape detection technology that can solve the problem is disclosed in Kosuke Sato, et al, “Three-Dimensional Image Measurement,” Shokodo Co., Ltd. pp. 109-117 (Document 2). More specifically, two types of pattern light, positive pattern light and negative pattern light, or reversal of the positive pattern light, are projected onto the target object in the technology disclosed in Document 2. The boundary of the pattern light is interpolated in accordance with the luminance distribution of the image, and the boundary of the pattern light is detected with sub-pixel precision, so that the error included in the boundary coordinates of the pattern light is reduced, enabling the three-dimensional shape of the target object to be detected with high precision.

SUMMARY

When the method described in Document 2 is used to detect the boundary of pattern light with sub-pixel precision, 2*n positive and negative images with pattern light projected and one image without pattern light projected must be taken. Because the pattern light must be projected a corresponding number of times and a corresponding number of images must taken, the measurement requires a long time.

In the space code method, special pattern light referred to as a gray-code (reflected binary code) pattern must be projected instead of pattern light having contrast provided as a pure binary code, so that a coding error will be reduced.

The present invention has been made to solve the problems described above. An object of the present invention is to provide a three-dimensional-shape detection apparatus, a three-dimensional-shape detection method, and a three-dimensional-shape detection program that can detect the boundary of pattern light with sub-pixel precision at a high speed without increasing the number of pattern light images to be taken.

A three-dimensional-shape detection apparatus provided to accomplish the object from one aspect of the present invention includes a projection unit that projects a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series, an imaging unit that takes an image of the object onto which each pattern light is projected by the projection unit, a luminance image generation unit that generates a plurality of luminance images by calculating the luminance of each pixel from the image taken by the imaging unit, a code image generation unit that generates a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images generated by the luminance image generation unit with respect to a certain threshold, a three-dimensional-shape calculation unit that calculates the three-dimensional shape of the object by utilizing the code image generated by the code image generation unit, a first-pixel detection unit that detects a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image, a luminance image extraction unit that extracts a luminance image having a light-dark boundary in a position corresponding to the first pixel detected by the first-pixel detection unit, from the plurality of luminance images, a pixel area determination unit that determines a pixel area that includes a pixel in a certain area adjacent to the first pixel, an approximate expression calculation unit that calculates an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area determined by the pixel area determination unit; and a boundary coordinate detection unit that calculates a position having a certain luminance threshold in the approximate expression calculated by the approximate expression calculation unit and detecting the boundary coordinates of the code of interest in accordance with the result of calculation. The three-dimensional-shape calculation unit calculates the three-dimensional shape of the object in accordance with the boundary coordinates detected by the boundary coordinate detection unit by using the code image.

According to the three-dimensional-shape detection apparatus configured as described above, the first-pixel detection means detects a first pixel which is adjacent to a pixel having a code of interest and has a code different from the code of interest, in a detection position in a direction crossing the pattern in the code image, in units of pixels. After the first pixel is detected, the luminance image extraction means extracts a luminance image having a light-dark boundary in the position corresponding to the first pixel, from the plurality of luminance images. Then, the approximate expression calculation means calculates an approximate expression expressing a change in luminance in the extracted luminance image in the pixel area determined by the pixel area determination means. The boundary coordinate detection means can calculate the position of boundary in the detection position with sub-pixel precision by calculating a position having a certain luminance threshold in accordance with the approximate expression. The calculated boundary coordinates are based on the coordinate of the detection position and the coordinate of the position having the certain luminance threshold, obtained from the approximate expression, and the three-dimensional-shape calculation means calculates the three-dimensional shape of the object by using the boundary coordinates.

According to the three-dimensional-shape detection apparatus, the coordinates of the light-dark boundary of pattern light in a certain detection position are obtained from an approximate expression expressing a change in luminance in a certain pixel area including the boundary coordinates and detected as a position having a certain luminance threshold in the approximate expression. Accordingly, the light-dark boundary in the detection position can be calculated with higher precision than the light-dark boundary in a code image. By calculating the three-dimensional shape on the basis of the result, the three-dimensional shape of the object can be calculated with high precision.

A three-dimensional-shape detection method provided from another aspect of the present invention includes a projection step of projecting a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series, an imaging step of taking an image of the object onto which each pattern light is projected in the projection step, a luminance image generation step of generating a plurality of luminance images by calculating the luminance of each pixel from each image taken in the imaging step, a code image generation step of generating a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images generated in the luminance image generation step with respect to a certain threshold, and a three-dimensional-shape calculation step of calculating the three-dimensional shape of the object by utilizing the code image generated in the code image generation step. The three-dimensional-shape detection method further includes, after the code image generation step, a first-pixel detection step of detecting a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image, a luminance image extraction step of extracting a luminance image having a light-dark boundary in a position corresponding to the first pixel detected in the first-pixel detection step, from the plurality of luminance images, a pixel area determination step of determining a pixel area that includes a pixel in a certain area adjacent to the first pixel, an approximate expression calculation step of calculating an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area determined by the pixel area determination step, and a boundary coordinate detection step of calculating a position having a certain luminance threshold in the approximate expression calculated in the approximate expression calculation step and detecting the boundary coordinates of the code of interest, in accordance with the result of calculation. The three-dimensional-shape calculation step calculates the three-dimensional shape of the object in accordance with the boundary coordinates detected in the boundary coordinate detection step by using the code image.

According to the three-dimensional-shape detection method configured as described above, a first pixel which is adjacent to a pixel having a code of interest and has a code different from the code of interest is detected in a detection position in a direction crossing the pattern in the code image, in units of pixels in the first-pixel detection step. After the first pixel is detected, a luminance image having a light-dark boundary in the position corresponding to the first pixel is extracted from the plurality of luminance images in the luminance image extraction step. Then, calculated in the approximate expression calculation step is an approximate expression expressing a change in luminance in the extracted luminance image in the pixel area determined in the pixel area determination step. The position of boundary in the detection position can be calculated with sub-pixel precision in the boundary coordinate detection step, by calculating a position having a certain luminance threshold in accordance with the approximate expression. The calculated boundary coordinates are based on the coordinate of the detection position and the coordinate of the position having the certain luminance threshold, obtained from the approximate expression, and the three-dimensional shape of the object is calculated by using the boundary coordinates in the three-dimensional-shape calculation step.

According to the three-dimensional-shape detection method, the coordinates of the light-dark boundary of pattern light in a certain detection position are obtained from an approximate expression expressing a change in luminance in a certain pixel area including the boundary coordinates and detected as a position having a certain luminance threshold in the approximate expression. Accordingly, the light-dark boundary in the detection position can be calculated with higher precision than the light-dark boundary in a code image. By calculating the three-dimensional shape on the basis of the result, the three-dimensional shape of the object can be calculated with high precision.

According to another aspect of the invention, there is a computer usable medium having computer readable instructions stored thereon, which, when executed by a computer, are configured to project a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series, to take an image of the object onto which each pattern light is projected, to generate a plurality of luminance images by calculating the luminance of each pixel from the taken image, to generate a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images with respect to a certain threshold, to calculate the three-dimensional shape of the object by utilizing the code image, to detect a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image, to extract a luminance image having a light-dark boundary in a position corresponding to the first pixel, from the plurality of luminance images, to determine a pixel area that includes a pixel in a certain area adjacent to the first pixel, to calculate an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area, and to calculate a position having a certain luminance threshold in the approximate expression and detecting the boundary coordinates of the code of interest in accordance with the result of calculation. The three-dimensional shape of the object is calculated in accordance with the boundary coordinates detected by using the code image.

According to the three-dimensional-shape detection program configured as described above, a first pixel which is adjacent to a pixel having a code of interest and has a code different from the code of interest is detected in a detection position in a direction crossing the pattern in the code image, in units of pixels in the first-pixel detection step. After the first pixel is detected, a luminance image having a light-dark boundary in the position corresponding to the first pixel is extracted from the plurality of luminance images in the luminance image extraction step. Then, calculated in the approximate expression calculation step is an approximate expression expressing a change in luminance in the extracted luminance image in the pixel area determined in the pixel area determination step. The position of boundary in the detection position can be calculated with sub-pixel precision in the boundary coordinate detection step, by calculating a position having a certain luminance threshold in accordance with the approximate expression. The calculated boundary coordinates are based on the coordinate of the detection position and the coordinate of the position having the certain luminance threshold, obtained from the approximate expression, and the three-dimensional shape of the object is calculated by using the boundary coordinates in the three-dimensional-shape calculation step.

According to the three-dimensional-shape detection program, the coordinates of the light-dark boundary of pattern light in a certain detection position are obtained from an approximate expression expressing a change in luminance in a certain pixel area including the boundary coordinates and detected as a position having a certain luminance threshold in the approximate expression. Accordingly, the light-dark boundary in the detection position can be calculated with higher precision than the light-dark boundary in a code image. By calculating the three-dimensional shape on the basis of the result, the three-dimensional shape of the object can be calculated with high precision.

BRIEF DESCRIPTION OF THE ACCOMPANYING DRAWINGS

FIG. 1 is an external perspective view of an image input-and-output apparatus.

FIG. 2 is a view showing an internal configuration of an imaging head.

FIG. 3(a) is a magnified view of an image projection section, FIG. 3(b) is a plan view of a light-source lens, and FIG. 3(c) is a front view of a projection LCD.

FIGS. 4(a) to 4(c) are views illustrating an arrangement in an LED array.

FIG. 5 is a block diagram showing an electric configuration of the image input-and-output apparatus.

FIG. 6 is a flow chart of main processing.

FIG. 7 is a flow chart of digital camera processing.

FIG. 8 is a flow chart of webcam processing.

FIG. 9 is a flow chart of projection processing.

FIG. 10 is a flow chart of 3D image processing.

FIG. 11(a) is a view illustrating the principle of the space code method, and FIG. 11(b) is a view showing mask patterns (gray code) different from those shown in FIG. 11(a).

FIG. 12(a) is a flow chart of three-dimensional-shape detection processing. FIG. 12(b) is a flow chart of imaging processing. FIG. 12(c) is a flow chart of three-dimensional measurement processing.

FIG. 13 is a view illustrating an overview of code boundary coordinate detection processing.

FIG. 14 is a flow chart of the code boundary coordinate detection processing.

FIG. 15 is a flow chart of processing for obtaining a code boundary coordinate with sub-pixel precision.

FIG. 16 is a flow chart of processing for obtaining the CCDY value of the boundary with respect to a luminance image having a mask pattern number of PatID[i].

FIGS. 17(a) to 17(c) are views illustrating lens aberration correction processing.

FIGS. 18(a) and 18(b) are views illustrating a method of calculating three-dimensional coordinates in a three-dimensional space from coordinates in the CCD space.

FIG. 19 is a flow chart of planar image processing.

FIGS. 20(a) to 20(c) are views illustrating original-posture calculation processing.

FIG. 21 is a flow chart of plane conversion processing.

FIG. 22(a) is a view illustrating an overview of curvature calculation processing, and

FIG. 22(b) is a view illustrating a planar image formed by the plane conversion processing.

FIG. 23(a) is a side view showing another example of light-source lenses, and FIG. 23(b) is a plan view showing the light-source lenses shown in FIG. 23(a).

FIG. 24(a) is a perspective view showing a fixed state of the light-source lenses, and FIG. 24(b) is a partial section view of the state.

DETAILED DESCRIPTION

A preferred embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is an external perspective view of an image input-and-output apparatus 1. The image input-and-output apparatus 1 includes a projection apparatus and a three-dimensional-shape detection apparatus according to the embodiment of the present invention.

The image input-and-output apparatus 1 has a variety of modes such as a digital camera mode for implementing a digital camera function, a webcam mode for implementing a web camera function, a 3D image mode for obtaining a 3D image by detecting a three-dimensional shape, a planar image mode for obtaining a planar image of a curved original, and the like.

FIG. 1 shows that an image projection section 13, which will be described later, projects a striped pattern light including a series of alternate light and dark patterns for three-dimensional-shape detection of original P serving as an object in the 3D image mode or the planar image mode.

The image input-and-output apparatus I includes an imaging head 2 shaped like a box, an arm member 3 shaped like a pipe, with one end connected to the imaging head 2, and a base 4 shaped like a letter L in a plan view, connected to the other end of the arm member 3.

The imaging head 2 is a case containing the image projection section 13 and an image pickup section 14, which will be described later. A cylindrical lens barrel 5 is disposed at the center in front of the imaging head 2. A viewfinder 6 is disposed diagonally above the lens barrel 5. A flash 7 is disposed in an opposite corner of the viewfinder 6. A part of a lens of an imaging optical system 21 of the image pickup section 14, described later, is exposed between the viewfinder 6 and the flash 7 in the front of the imaging head 2. An image of the object is input through the exposed part of the imaging optical system.

The lens barrel 5 is formed to protrude from the front of the imaging head 2 and becomes a cover around a projection optical system 20 of the image projection section 13. The lens barrel 5 holds the projection optical system 20, allows the entire projection optical system 20 to be moved for focusing, and prevents the projection optical system 20 from being damaged. A part of the lens of the projection optical system 20 of the image projection section 13 is exposed from an end face of the lens barrel 5, and image signal light is projected from the exposed part to a projection plane.

The viewfinder 6 includes an optical lens provided from the rear face to the front face of the imaging head 2. The user looking into the viewfinder 6 from the rear of the imaging head 2 can see a range almost identical to a range in which the imaging optical system 21 forms an image on a CCD 22.

The flash 7 is a light source providing an additional amount of light required in the digital camera mode, for instance, and has a discharge tube filled with a xenon gas. The flash 7 can be used repeatedly when an internal capacitor (not shown) of the imaging head 2 discharges.

A release button 8 is disposed in the top face of the imaging head 2 near the front face. A mode changeover switch 9 is disposed behind the release button 8. An LCD monitor 10 is disposed at a side opposite to the mode changeover switch 9.

The release button 8 includes a two-position pushbutton switch which can be half-pressed or full-pressed. The state of the release button 8 is managed by a processor 15, which will be described later. When the release button 8 is half-pressed, a commonly-known autofocus (AF) function and autoexposure (AF) function are activated under the control of the processor 15, and the focus, aperture, and shutter speed are adjusted. When the release button 8 is full-pressed, an image is taken, or the like.

The mode changeover switch 9 is a switch for setting the digital camera mode, webcam mode, 3D image mode, planar image mode, off mode, or any other mode. The state of the mode changeover switch 9 is managed by the processor 15. When the processor 15 detects the state of the mode changeover switch 9, corresponding mode processing is executed.

The LCD monitor 10 includes a liquid crystal display and shows an image of an image signal received from the processor 15 to the user. The LCD monitor 10 can display an image taken in the digital camera mode or the webcam mode, an image obtained as a result of three-dimensional-shape detection in the 3D image mode, or a planar image in the planar image mode, and the like.

On a side face of the imaging head 2, an antenna 11 used as a radio frequency (RF) interface is provided in an upper part, and a coupling member 12 for coupling the imaging head 2 and the arm member 3 is also disposed.

The antenna 11 is used to send an image data taken in the digital camera mode, a 3D image data taken in the 3D image mode, or the like through an RF driver 24, which will be described later, to an external interface by radio communication.

The coupling member 12 is shaped like a ring, and a female thread is formed on its inner face. The coupling member 12 is rotatably secured to a side face of the imaging head 2. A male thread is formed on one end of the arm member 3. The imaging head 2 and the arm member 3 can be detachably coupled by fitting the female thread of the coupling member 12 and the male thread of the arm member 3, and the imaging head 2 can be fixed at a certain angle. The imaging head 2 can be used as a usual digital camera when it is detached from the arm member 3.

The arm member 3 holds the imaging head 2 in a certain variable imaging position and has a pleated flexible pipe that can be bent into a desired shape. The arm member 3 can direct the imaging head 2 into a desired position.

The base 4 is placed on a desk or a table and supports the imaging head 2 and the arm member 3. The base 4 is shaped like a letter L in a plan view and can support the imaging head 2 and the like with stability. The base 4 and the arm member 3 are detachably coupled. This makes it easy to carry the image input-and-output apparatus 1 and to house the image input-and-output apparatus 1 in a small space.

FIG. 2 is an outline diagram showing an internal configuration of the imaging head 2. The imaging head 2 contains the image projection section 13, the image pickup section 14, and the processor 15.

The image projection section 13 is a unit for projecting a certain image onto the projection plane. The image projection section 13 includes a substrate 16, a plurality of LEDs 17 (hereafter collectively referred to as an LED array 17A), a light-source lens 18, a projection LCD 19, and the projection optical system 20, in that order in the projecting direction. The image projection section 13 will be described in further detail later with reference to FIGS. 3(a) to 3(c).

The image pickup section 14 is a unit for taking an image of original P serving as the object. The image pickup section 14 includes the imaging optical system 21 and the CCD 22 along the light input direction.

The imaging optical system 21 has a plurality of lenses. The imaging optical system 21 has a commonly-known auto-focus function, automatically adjusts the focal length and aperture, and forms external light into an image on the CCD 22.

The CCD 22 has photoelectric transducers such as a matrix of charge coupled devices (CCDs). The CCD 22 generates a signal depending on the color and intensity of light of the image formed on the surface of the CCD 22 through the imaging optical system 21, converts the signal to digital data, and outputs the data to the processor 15.

The processor 15 is electrically connected to the flash 7, the release button 8, the mode changeover switch 9, an external memory 27, and a cache memory 28. The LCD monitor 10 is connected through a LCD monitor driver 23, the antenna 11 is connected through an RF driver 24, a battery 26 is connected through a power interface 25, the LED array 17A is connected through a light-source driver 29, the projection LCD 19 is connected through a projection LCD driver 30, and the CCD 22 is connected through a CCD interface 31, to the processor 15. These components connected to the processor 15 are managed by the processor 15.

The external memory 27 is a detachable flash ROM and stores three-dimensional information and an image taken in the digital camera mode, webcam mode, or 3D image mode. An SD card, compact flash (registered trademark) card, and the like can be used as the external memory 27, for instance.

The cache memory 28 is a high-speed storage device. For instance, an image taken in the digital camera mode is transferred to the cache memory 28 at a high speed, and the image is stored in the external memory 27 after the processor 15 finishes image processing. More specifically, an SDRAM, DDRRAM, and the like can be used.

The power interface 25; the light-source driver 29, the projection LCD driver 30, and the CCD interface 31 are integrated circuits (ICs). The power interface 25, the light-source driver 29, the projection LCD driver 30, and the CCD interface 31 control the battery 26, the LED array 17A, the projection LCD 19, and the CCD 22, respectively.

FIG. 3(a) is a magnified view of the image projection section 13, FIG. 3(b) is a plan view of the light-source lens 18, and FIG. 3(c) is a view showing a positional relationship of the projection LCD 19 and the CCD 22. As has been described earlier, the image projection section 13 includes the substrate 16, the LED array 17A, the light-source lens 18, the projection LCD 19, and the projection optical system 20, along the direction of projection.

The LED array 17A is mounted to, and electrical wiring for the LED array 17A is installed in, the substrate 16. More specifically, the substrate 16 can be an aluminum substrate coated with an insulating resin and a pattern formed by a nonelectrolytic plating on the coating or an epoxy-glass-rigid-core substrate with a single-layer or multilayer structure.

The LED array 17A is a light source emitting radial light toward the projection LCD 19. The LED array 17A includes rows of staggered light emitting diodes (LEDs) 17 provided on the substrate 16. The LEDs 17 are pasted to the substrate 16 by a silver paste and electrically connected to the substrate 16 through bonding wire.

The plurality of LEDs 17 used as a light source can convert electricity to light with higher efficiency (higher electrooptic conversion efficiency) than an incandescent lamp, a halogen lamp, or the like used as the light source, and can suppress the generation of infrared rays and ultraviolet rays. According to the embodiment, the light source can be driven with reduced power requirements, and a power saving and a longer life can be achieved. A rise in temperature of the apparatus can also be reduced.

Because the LEDs 17 generates greatly fewer heat rays than the halogen lamp and the like, the light-source lens 18 and the projection optical system 20 can use a plastic lens, which will be described later. Consequently, the cost and weight of the light-source lens 18 and the projection optical system 20 can be reduced in comparison with when a glass lens is used.

The LEDs 17 constituting the LED array 17A emit light in the same color, or amber light. The LEDs 17 are made of a material of four elements: Al, In, Ga, and P. Accordingly, chromatic aberration correction which would be required when light is emitted in different colors is not necessary, and an achromatic lens for correcting chromatic aberration is not required in the projection optical system 20. A projection means of an inexpensive material with a simple surface structure can be provided.

Because the amber LED of the four-element material having an electrooptic conversion efficiency of about 80 lumen/W higher than the LED of another color is used, a higher luminance, power saving, and a lower life can be achieved. The effect of the staggered arrangement of the LEDs 17 will be described with reference to FIGS. 4(a) to 4(c).

To be more specific, the LED array 17A has fifty-nine LEDs 17, and each LED 17 is driven at 20 mA and 2.5 V (50 mW). The fifty-nine LEDs 17 consume about 3 watts of power. When the projection optical system 20 projects light emitted from the LED 17 through the light-source lens 18 and the projection LCD 19, the luminance of the ray bundle is about 25 ANSI lumen even in full projection.

When a three-dimensional shape of an object such as a human or animal face is detected in the 3D image mode, for instance, this level of luminance does not give glare to the person or animal, enabling the three-dimensional shape to be detected while the person or animal is opening their eyes.

The light-source lens 18 is a lens as a light collecting optical system for collecting light radially emitted from the LED array 17A. The material of the lens is made of optical plastics such as an acrylic resin.

To be more specific, the light-source lens 18 includes a convex lens section 18 a provided to jut out toward the side of the projection LCD 19 in a position facing each LED 17 of the LED array 17A, a base section 18 b supporting the convex lens section 18 a, an epoxy sealing agent 18 c for filling an opening containing the LED array 17A in the internal space of the base section 18 b for sealing the LED 17 and gluing the substrate 16 and the light-source lens 18, and a positioning pin 18 d protruding from the base section 18 b to the side of the substrate 16 for connecting the light-source lens 18 and the substrate 16.

The light-source lens 18 is fixed on the substrate 16 by inserting the positioning pin 18 d into an oval hole 16 a made in the substrate 16 while holding the LED array 17A in the internal opening.

Therefore, the light-source lens 18 can be provided in a reduced space. The substrate 16 has a function to hold the LED array 17A and also a function to support the light-source lens 18, eliminating the need for providing a separate support of the light-source lens 18, so that the number of components can be reduced.

The lens sections 18 a are disposed in positions facing the LEDs 17 of the LED array 17A in a one-to-one relationship.

The radial light emitted from the LEDs 17 is efficiently collected by the lens sections 18 a facing the LEDs 17, and the light is applied to the projection LCD 19 as high-directivity radial light, as shown in FIG. 3(a). One reason of the high directivity is that variations in transmittance in the plane can be suppressed by applying light almost perpendicular to the projection LCD 19. Another reason of the high directivity is that light which can pass an internal aperture is limited to a range of +5% to −5% of the normal because the projection optical system 20 has telecentric characteristics with an incident NA of about 0.1. Accordingly, important factors to improve the image quality are that the angle of outgoing light from the LEDs 17 is adjusted to be normal to the projection LCD 19 and that most of the ray bundles fall in the range of +5% to −5%. If light beyond the normal range is applied to the projection LCD 19, the optical rotation of the liquid crystal changes the transmittance in accordance with the incident angle, resulting in variations in transmittance.

The projection LCD 19 is a spatial modulation element which performs spatial modulation of light collected through the light-source lens 18 and outputs image signal light to the projection optical system 20. To be more specific, the projection LCD 19 includes a flat liquid crystal display having a height and width different from each other in length.

As shown in FIG. 3(c), the pixels of the projection LCD 19 are arranged in parallel rows, alternating between one linear pixel row along the longitudinal direction of the projection LCD 19 and another pixel row with pixel positions shifted by a predetermined distance along the longitudinal direction of the projection LCD 19 from those in the one linear pixel row.

FIG. 3(c) shows the face on the side of the front of the imaging head 2, and light is emitted toward the projection LCD 19 from the other face. The light returned from the object is sent from the face shown in FIG. 3(c) to the other face, and the image of the object is formed on the CCD 22.

Since the pixels of the projection LCD 19 are arranged in rows in the longitudinal direction in a staggered configuration, light subjected to spatial modulation by the projection LCD 19 can be controlled at a ½ pitch in a direction perpendicular to the longitudinal direction (in a transverse direction). Accordingly, the projection pattern can be controlled at a small pitch, and a high-precision three-dimensional shape can be detected with a high resolution.

When striped pattern light including a series of alternate light and dark patterns is thrown onto the object to detect the three-dimensional shape of the object in the 3D image mode or planar image mode, which will be described later, the boundaries between the light and dark patterns can be controlled at a ½ pitch by aligning the stripe with the transverse direction of the projection LCD 19. Accordingly, a three-dimensional shape can be detected with high precision.

The projection LCD 19 and the CCD 22 are placed inside the imaging head 2 as shown in FIG. 3(c). To be more specific, because the projection LCD 19 and the CCD 22 are disposed with their wide faces directed almost in the same direction, the image projected from the projection LCD 19 onto the projection plane can be formed directly on the CCD 22 without deflecting the projection image by a half mirror or the like.

The CCD 22 is disposed in the longitudinal direction of the projection LCD 19 (in the direction of rows of pixels). When the three-dimensional shape of an object is detected by triangulation in the 3D image mode or planar image mode, the angle formed by the CCD 22 and the object can be controlled at a ½ pitch. Accordingly, the three-dimensional shape can be detected with high precision.

The projection optical system 20 includes a plurality of lenses for projecting image signal light which has passed the projection LCD 19 onto the projection plane. The projection optical system 20 includes telecentric lenses made by a combination of glass and plastic. In the telecentric configuration, a main beam passing the projection optical system 20 is parallel to the optical axis in the incoming space, and the exit pupil is at infinity. The telecentric configuration allows light passing the projection LCD 19 within the range of +5% to −5% of the normal to be projected, and the image quality can be improved.

FIGS. 4(a) to 4(c) are views illustrating an arrangement in the LED array 17A. FIG. 4(a) shows an illumination distribution of light passing the light-source lens 18. FIG. 4(b) is a plan view showing the arrangement in the LED array 17A. FIG. 14(c) is a view showing combined illumination distribution in the face of the projection LCD 19.

As shown in FIG. 4(a), light passing the light-source lens 18 is designed to reach the surface of the projection LCD 19 as light having the illumination distribution shown in the right part of FIG. 4(a) with half angle θ (about 5 degrees) at half maximum.

As shown in FIG. 4(b), the plurality of LEDs 17 are arranged in a staggered configuration on the substrate 16. To be more specific, a plurality of straight rows of LEDs 17 disposed at a pitch of “d” are arranged in parallel at a pitch of √3/2 d, and every other row is slid by ½ d in the same direction with reference to the previous row.

In other words, the distance between one LED 17 and an adjacent LED becomes d (a triangular grid of LEDs is formed).

The length of “d” is determined to be equal to or smaller than the full width at half maximum (FWHM) of the illumination distribution formed on the projection LCD 19 by light emitted from one LED 17.

The combined illumination distribution of light passing the light-source lens 18 and reaching the surface of the projection LCD 19 becomes a straight line with small ripples as shown in FIG. 4(c). Light can be applied to the face of the projection LCD 19 almost uniformly. Accordingly, variations in illumination on the projection LCD 19 can be suppressed, and a high-quality image can be projected as a result.

FIG. 5 is a block diagram showing an electric configuration of the image input-and-output apparatus 1. The components described earlier will not be explained again. The processor 15 has a CPU 35, a ROM 36, and a RAM 37.

The CPU 35 executes various processing in accordance with programs stored in the ROM 36, using the RAM 37. Processing executed under the control of the CPU 35 includes the sensing of the pressing of the release button 8, the capturing of image data from the CCD 22, the transfer and storage of the image data, and sensing of the state of the mode changeover switch 9.

The ROM 36 stores a camera control program 36 a, a pattern light imaging program 36 b, a luminance image generation program 36 c, a code image generation program 36 d, a code boundary extraction program 36 e, a lens aberration correction program 36 f, a triangulation calculation program 36 g, an original-posture calculation program 36 h, and a plane conversion program 36 i.

The camera control program 36 a is a program related to control of the entire image input-and-output apparatus 1 including main processing shown in FIG. 6.

The pattern light imaging program 36 b is a program for imaging the object with and without pattern light projected in order to detect the three-dimensional shape of original P

The luminance image generation program 36 c is a program for taking a difference between the image taken with pattern light projected by the pattern light imaging program 36 b and the image taken without pattern light projected and generating a luminance image of the projected pattern light.

Pattern light of a plurality of types is projected in a time series, and images are taken with each type of pattern light. A plurality of types of luminance images are formed by taking the difference between the images taken with pattern light projected and corresponding images taken without pattern light projected.

The code image generation program 36 d is a program for generating a code image having a certain code assigned to each pixel by superposing a plurality of luminance images generated by the luminance image generation program 36 c.

The code boundary extraction program 36 e is a program for obtaining code boundary coordinates with sub-pixel precision by using the code image generated by the code image generation program 36 d and the luminance image generated by the luminance image generation program 36 c.

The lens aberration correction program 36 f is a program for correcting the aberration of the imaging optical system 21 with respect to the code boundary coordinates obtained with sub-pixel precision by the code boundary extraction program 36 e.

The triangulation calculation program 36 g is a program for calculating the three-dimensional coordinates of a real space with respect to the boundary coordinates from the boundary coordinates of the code after aberration correction by the lens aberration correction program 36 f.

The original-posture calculation program 36 h is a program for inferring the three dimensional shape of original P from the three-dimensional coordinates calculated by the triangulation calculation program 36 g.

The plane conversion program 36 i is a program for generating a planar image appeared to be taken in front of original P, on the basis of the three-dimensional shape of original P calculated by the original-posture calculation program 36 h.

The RAM 37 includes an image-with-pattern-light storage section 37 a, an image-without-pattern-light storage section 37 b, a luminance image storage section 37 c, a code image storage section 37 d, a code boundary coordinate storage section 37 e, an ID storage section 37 f, an aberration correction coordinate storage section 37 g, a three-dimensional coordinate storage section 37 h, an original-posture calculation result storage section 37 i, a plane conversion result storage section 37 j, a projection image storage section 37 k, and a working area 37 l, assigned as storage areas.

The image-with-pattern-light storage section 37 a stores an image with pattern light taken with pattern light projected onto original P, by the pattern light imaging program 36 b. The image-without-pattern-light storage section 37 b stores an image without pattern light taken without pattern light projected onto original P, by the pattern light imaging program 36 b.

The luminance image storage section 37 c stores a luminance image generated by the luminance image generation program 36 c. The code image storage section 37 d stores a code image generated by the code image generation program 36 d. The code boundary coordinate storage section 37 e stores the boundary coordinates of each code obtained with sub-pixel precision extracted by the code boundary extraction program 36 e. The ID storage section 37 f stores an ID and the like assigned to a luminance image having a change in brightness in the position of a pixel having a boundary. The aberration correction coordinate storage section 37 g stores the boundary coordinates of a code after aberration correction by the lens aberration correction program 36 f. The three-dimensional coordinate storage section 37 h stores the three-dimensional coordinates of the real space calculated by the triangulation calculation program 36 g.

The original-posture calculation result storage section 37 i stores parameters of the three-dimensional shape of original P calculated by the original-posture calculation program 36 h. The plane conversion result storage section 37 j stores the result of plane conversion by the plane conversion program 36 i. The projection image storage section 37 k stores image information projected by the image projection section 13. The working area 37 l holds data temporarily used for calculation by the CPU 15.

FIG. 6 is a flow chart of the main processing executed under the control of the CPU 35. Digital camera processing S605, webcam processing S607, 3D image processing S607, and planar image processing S611 of the main processing will be described later in further detail.

First, in the main processing, power is turned on (S601), and the processor 15, interfaces, and the like are initialized (S602).

A key scan (S603) is carried out to determine the state of the mode changeover switch 9. It is determined whether the mode changeover switch 9 selects the digital camera mode (S604). If the digital camera mode is selected (S604: Yes), the digital camera processing, which will be described later, starts (S605).

If the digital camera mode is not selected (S604: No), it is determined whether the mode changeover switch 9 selects the webcam mode (S606). If the webcam mode is selected (S606: Yes), the webcam processing, which will be described later, starts (S607).

If the webcam mode is not selected (S605: No), it is determined whether the mode changeover switch 9 selects the 3D image mode (S608). If the 3D image mode is selected (S608: Yes), the 3D image processing, which will be described later, starts (S609).

If the 3D image mode is not selected (S608: No), it is determined whether the mode changeover switch 9 selects the planar image mode (S610). If the planar image mode is selected (S610: Yes), the planar image processing, which will be described later, starts (S611).

If the planar image mode is not selected (S610: No), it is determined whether the mode changeover switch 9 selects the off mode (S612). If the off mode is not selected (S612: No), processing from step S603 is repeated. If it is determined in step S612 that the off mode is selected (S612: Yes), the processing ends.

FIG. 7 is a flow chart of the digital camera processing (S605 in FIG. 6). The digital camera processing is performed to obtain an image taken by the image pickup section 14.

First, in this processing, a high-resolution setting signal is sent to the CCD 22 (S701). With this signal, a high-quality image can be provided to the user.

A viewfinder image (image in the range seen through the viewfinder 6) is displayed on the LCD monitor 10 (S702). The user can see the image to be taken (imaging range), before taking an actual image, by seeing the image displayed on the LCD monitor 10 without looking into the viewfinder 6.

The release button 8 is scanned (S703 a) to check whether the release button 8 is half-pressed (S703 b). If the button is half-pressed (S703 b: Yes), the autofocus (AF) function and the autoexposure (AE) function are activated to adjust the focus, aperture, and shutter speed (S703 c). If the button is not half-pressed (S703 b: No), the processing from step S703 a is repeated.

The release button 8 is scanned again (S703 d) to check whether the release button 8 is full-pressed (S703 e). If the release button 8 is full-pressed (S703 e: Yes), it is checked whether the flash mode is selected (S704).

If the flash mode is selected (S704: Yes), the flash 7 is fired (S705), and the image is taken (S706). If the flash mode is not selected (S704: No), the image is taken without firing the flash 7 (S706). If it is determined that the button is not full-pressed (S703 e: No), the processing from step S703 a is repeated.

The taken image is transferred from the CCD 22 to the cache memory 28 (S707), and the image stored in the cache memory 28 is displayed on the LCD monitor 10 (S708). By transferring the image to the cache memory 28 instead of a main memory, the image can be displayed on the LCD monitor 10 quickly. Then, the image is stored in the external memory 27 (S709).

It is determined whether the mode selected by the mode changeover switch 9 has been changed (S710). If no change is found (S710: Yes), the processing from S702 is repeated. If a change is found (S710: No), the processing ends.

FIG. 8 is a flow chart of the webcam processing (S607 in FIG. 6). The webcam processing is performed to send an image (still image or moving image) taken by the image pickup section 14 to an external network. In this embodiment, a moving image is taken and sent to the external network.

First, in the processing, a low-resolution setting signal is sent to the CCD 22 (S801). The commonly-known autofocus function and autoexposure function are activated to adjust the focus, aperture, and shutter speed (S802), and an image taking process starts (S803).

The taken image is displayed on the LCD monitor 10 (S804). The viewfinder image is stored in the projection image storage section 37 k (S805). Projection processing, which will be described later, is performed (S806). The image stored in the projection image storage section 37 k is projected onto the projection plane.

The taken image is transferred from the CCD 22 to the cache memory 28 (S807). The image transferred to the cache memory 28 is sent through the RF interface to an external network (S808).

It is determined whether the mode selected by the mode changeover switch 9 has been changed (S809). If no change is found (S809: Yes), the processing from S802 is repeated. If a change is found (S809: No), the processing ends.

FIG. 9 is a flow chart of the projection processing (S806 in FIG. 8). The processing is performed to project the image stored in the projection image storage section 37 k onto the projection plane by the image projection section 13. First, in the processing, it is checked whether an image is stored in the projection image storage section 37 k (S901). If a image is stored (S901: Yes), the image stored in the projection image storage section 37 k is transferred to the projection LCD driver 30 (S902). The projection LCD driver 30 sends an image signal corresponding to the image to the projection LCD 19, and the image is displayed on the projection LCD (S903).

The light-source driver 29 is driven (S904). An electric signal from the light-source driver 29 turns on the LED array 17A (S905), and the processing ends.

When the LED array 17A is turned on, light emitted from the LED array 17A passes the light-source lens 18 and reaches the projection LCD 19. The projection LCD 19 performs spatial modulation corresponding to the image signal sent from the projection LCD driver 30, and image signal light is output. The image signal light output from the projection LCD 19 passes the projection optical system 20 and projects an image onto the projection plane.

FIG. 10 is a flow chart of the 3D image processing (S609 in FIG. 6). The 3D image processing is performed to detect the three-dimensional shape of the object, obtain the detected three-dimensional shape as a 3D image, and display and project the 3D image.

First, in the processing, a high-resolution setting signal is sent to the CCD 22 (S1001). A viewfinder image is displayed on the LCD monitor 10 (S1002).

The release button 8 is scanned (S1003 a) to check whether the release button 8 is half-pressed (S1003 b). If the button is half-pressed (S1003 b: Yes), the autofocus (AF) function and autoexposure (AE) function are activated to adjust the focus, aperture, and shutter speed (S1003 c). If the button is not half-pressed (S1003 b: No), the processing from step S1003 a is repeated.

The release button 8 is scanned again (S1003 d) to check whether the release button 8 is full-pressed (S1003 e). If the release button 8 is full-pressed (S1003 e: Yes), it is checked whether the flash mode is selected (S1003 f).

If the flash mode is selected (S1003 f: Yes), the flash 7 is fired (S1003 g), and the image is taken (S1003 h). If the flash mode is not selected (S1003 f: No), the image is taken without firing the flash 7 (S1003 h). If it is determined in step S1003 e that the button is not full-pressed (S1003 e: No), the processing from step S1003 a is repeated.

Three-dimensional-shape detection processing, which will be described later, is performed, and the three-dimensional shape of the object is detected (S1006).

The three-dimensional shape detected in the three-dimensional-shape detection processing (S1006) is stored in the external memory 27 (S1007), and the result of three-dimensional-shape detection is displayed on the LCD monitor 10 (S1008). The result of three-dimensional-shape detection is displayed as a group of three-dimensional coordinates (XYZ) of vertices measured in the real space.

The vertices obtained as a result of three-dimensional shape detection are connected to form a polygon, and a 3D image (3D CG image) displaying the surfaces is stored in the projection image storage section 37 k as a result image of three-dimensional-shape detection (S1009). Projection processing is performed (S1010), in the same way as the projection processing of step S806 in FIG. 8. When an inverse function of an equation for converting coordinates on the projection LCD 19 to three-dimensional coordinates, which will be described with reference to FIGS. 18(a) and 18(b), is used to calculate the coordinates on the projection LCD 19 corresponding to the obtained three-dimensional coordinates, the resultant three-dimensional coordinates can be projected onto the projection plane.

It is determined whether the mode selected by the mode changeover switch 9 has been changed (S1011). If no change is found (S1011: Yes), the processing from step S702 is repeated. If a change is found (S1011: No), the processing ends.

FIG. 11(a) is a view illustrating the principle of the space code method used to detect a three-dimensional shape in the three-dimensional-shape detection processing (S1006 in FIG. 10). FIG. 11(b) is a view showing pattern light different from that shown in FIG. 11(a). Either of the pattern lights shown in FIG. 11(a) and FIG. 11(b) can be used. A gray level code, which is a multiple-tone code, can also be used.

The space code method is described in detail in Kosuke Sato, et al. “Distance Image Input by Space Code,” Transactions of the Institute of Electronics and Communication Engineers of Japan, 85/3 Vol. J68-D No. 3, pp. 369-375.

The space code method is one method of detecting the three-dimensional shape of an object by triangulation between projection light and observed images. As shown in FIG. 11 (a), projection light source L and observing instrument O are disposed with a distance D left between them, and the space is divided into narrow fan-shaped areas and coded.

When three mask patterns A, B, and C shown in the figure are projected in sequence from the MSB, each fan-shaped area is coded to “1” of light or “0” of dark according to the mask pattern. For instance, an area including point P is dark with mask patterns A and B and is light with mask pattern C, and is coded as 001 (A=0, B=0, C=1).

Each fan-shaped area is assigned a code corresponding to the direction φ, and the boundary of codes can be considered as one slit light. An image of a scene is taken through each mask by the observing instrument, or a camera, and the light and dark patterns are binarized to configure a bit plane of memory.

The horizontal position (address) of the obtained multiple-bit-plane image corresponds the observing direction 0, and the contents of memory at the address give projection light code φ. The coordinates of a point of interest are determined by θ and φ.

Mask patterns A, B, and C shown in FIG. 11(a) use pure binary codes. If a mask is misaligned, there is a danger that a great error occurs on the boundary of areas.

Point Q in FIG. 11(a) is on the boundary of area 3 (011) and area 4 (100). If mask A is misaligned, the code of area 7 (111) can be given. In other words, a great error can occur if the Hamming distance between adjacent areas is 2 or greater.

It is considered that the coding error can be avoided by using mask patterns where the Hamming distance between adjacent areas is always 1, as shown in FIG. 11(b).

FIG. 12(a) is a flow chart of the three-dimensional-shape detection processing (S1006 in FIG. 10). First, in the processing, imaging processing is performed (S1210). In the imaging processing, striped pattern light (see FIG. 1) including a series of alternate light and dark patterns is projected onto the object in a time series from the image projection section 13 by using the plurality of pure-binary-code mask patterns shown in FIG. 11(a), and an image taken with each pattern light projected and an image taken without the pattern light are obtained.

When the imaging processing ends (S1210), three-dimensional measurement processing is performed (S1220). In the three-dimensional measurement processing, the image with pattern light and the image without pattern light obtained in the imaging processing are used to measure the actual three-dimensional shape of the object. When the three-dimensional measurement processing ends (S1220), the processing ends.

FIG. 12(b) is a flow chart of the imaging processing (S1210 in FIG. 12(a)). The processing is executed in accordance with the pattern light imaging program 36 a. First, an image of the object is taken by the image pickup section 14 without projecting pattern light from the image projection section 13, and the image without pattern light is obtained (S1211). The image without pattern light is stored in the image-without-pattern-light storage section 37 b.

Counter “i” is initialized (S1212), and it is determined whether the value of counter “i” is the maximum value imax (S1213). The maximum value imax is determined in accordance with the number of mask patterns used. If eight types of mask patterns are used, the maximum value imax is set to 8.

If the value of counter “i” is smaller than the maximum value imax (S1213: Yes), mask pattern “i” is displayed on the projection LCD 19, and pattern light “i” projected through mask pattern “i” is projected onto the projection plane (S1214). The image of the state in which the pattern light is projected is taken by the image pickup section 14 (S1215).

An image with pattern light taken by projecting pattern light “i” onto the object is obtained in this way. The obtained image with pattern light is stored in the image-with-pattern-light storage section 37 a.

After the image is taken, projection of pattern light “i” ends (S1216), and counter “i” is incremented by “1” (S1217) to project the next pattern light. The processing from step S1213 is repeated.

When it is determined that the value of counter “i” exceeds the maximum value imax (S1213: No), the processing ends. In the imaging processing, one image without pattern light and the same number of images with pattern light as the maximum value imax are obtained.

FIG. 12(c) is a flow chart of the three-dimensional measurement processing (S1220 in FIG. 12(a)). The processing is executed in accordance with the luminance image generation program 36 c. First, in the processing, a luminance image is generated (S1221). The luminance here is a Y value in a YCbCr space and is calculated from the RGB values of each pixel as Y=0.2989×R+0.5866×G+0.1145×B By obtaining the Y value of each pixel, a luminance image of each image with pattern light or without pattern light is generated. The generated luminance image is stored in the luminance image storage section 37 c. A number corresponding to the pattern light number is assigned to each luminance image.

Generated luminance images are combined by using the space code method described above in accordance with the code image generation program 36 d, and a code image of coded pixels is generated (S1222).

The code image can be generated by combining results of comparison between each pixel of the luminance image of an image with pattern light stored in the luminance image storage section 37 c and a predetermined luminance threshold. The generated code image is stored in the code image storage section 37 d.

The code boundary coordinate detection processing, which will be described later, is performed in accordance with the code boundary extraction program 36 e (S1223) to detect the coordinates of the boundary of codes assigned to pixels with sub-pixel precision.

Lens aberration correction processing is performed in accordance with the lens aberration correction program 36 f (S1224). Through this processing, an error due to distortion of the imaging optical system 21 in the code boundary coordinates detected in step S1223 can be corrected.

Real space conversion processing based on triangulation is performed in accordance with the triangulation calculation program 36 g (S1225). The code boundary coordinates on the CCD space after aberration correction is converted to three-dimensional coordinates in the real space by this processing, and the three-dimensional coordinates are obtained as a result of three-dimensional-shape detection.

FIG. 13 is a view illustrating an overview of the code boundary coordinate detection processing (S1223 in FIG. 12). An upper diagram shows borderline K serving as a boundary between the actual light and dark patterns in the CCD space. A thick line in the figure indicates the boundary between code “1” and other codes given by coding the pattern light in the space code method.

Coding by the space code method is performed in units of pixels. There is a sub-pixel difference between actual borderline K of pattern light and the coded boundary (thick line in the figure). The code boundary coordinate detection processing is intended for the detection of the coordinates of the code boundary with sub-pixel precision.

First, in the processing, first pixel G where code of interest (hereafter referred to as curCode) is changed to another code in a certain detection position (hereafter referred to as curCCDX) is detected (first-pixel detection process).

For instance, check pixels detected in curCCDX in the direction from top to bottom. The pixels above the boundary (thick line) have curCode, and the code of the pixel immediately below the boundary is changed from curCode. This pixel is detected as first pixel G.

All the luminance images having a change in brightness in the position of first pixel G are extracted from the luminance images stored in the luminance image storage section 37 c in step S1221 of FIG. 12 (luminance image extraction process).

To identify a pixel area used for approximation, the code image is referenced in the position of curCCDX−2, a position moved to the left of the detection position, to find a pixel where the code changes from the code of interest, curCode, to another, or a boundary pixel (pixel H in detection position of curCCDX−2). A predetermined pixel range extending from the pixel (range of −3 pixels and +2 pixels in the Y-axis direction, in the shown example) is determined (part of pixel range determination means).

An approximate expression (indicated by a thick line in the figure) concerning the pixel position and luminance in the Y direction is obtained in the predetermined range, as expressed in the bottom left graph in the figure. Y coordinate Y1 of a point of intersection with luminance threshold “bTh” given by the approximate expression is obtained (part of boundary coordinate detection process).

Luminance threshold “bTh” may also be calculated from a predetermined range (half of the average luminance of the pixels) or may be a predetermined fixed value. Now, the light-dark boundary can be detected with sub-pixel precision.

Detection position curCCDX−2 is moved to the right by “1”, and the same processing as described above is performed in position curCCDX−1 to obtain a representative value in curCCDX−1 (part of boundary coordinate detection process).

The representative value in each detection position is obtained in the pixel area (hatched by parallel lines sloping to the right) determined by the predetermined range in the Y-axis direction about each boundary pixel and the range of curCCDX−2 to curCCDX+2 in the X-axis direction.

The processing is performed for all luminance images having a pixel changing from curCode to another code, and the weighed average of the representative values of the luminance images is used as the boundary coordinate of curCode (part of boundary coordinate detection process).

Now, the code boundary coordinates can be detected with sub-pixel precision, and the three-dimensional shape of the object can be detected with high precision by performing the real space conversion processing (S1225 in FIG. 12) based on triangulation, using the boundary coordinates.

Because the boundary coordinates can be detected with sub-pixel precision by using the approximate expressions calculated on the basis of the luminance images, the number of images to be taken should not be increased. The pattern light of light and dark patterns of pure binary codes can be used, and special pattern light of gray code does not need to be used.

In this embodiment, the pixel area for approximation is described as an area determined by the range of −3 pixels and +2 pixels in the Y-axis direction around the boundary pixel in each detection position and the range of cur CCDX−2 to curCCDX+2 of the detection positions in the X-axis direction, but the pixel area is not limited to that determined by those Y-axis range and the X-axis range. For instance, the pixel range can be just a predetermined Y-axis range around the boundary pixel in detection position curCCDX.

FIG. 14 is a flow chart of the code boundary coordinate detection processing (S1223 in FIG. 12(c)). This processing is executed in accordance with the code boundary extraction program 36 e. First, in the processing, the pixels in a code boundary coordinate array in the CCD space are initialized (S1401), and curCCDX is set to the initial coordinate (S1402).

It is determined whether curCCDX is lower than or equal to the final coordinate (S1403). If curCCDX is lower than or equal to the final coordinate (S1403: Yes), curCode is set to 0 (S1404). curCode is set to the minimum value at the beginning.

It is determined whether curCode is smaller than the maximum code (S1405). If curCode is smaller than the maximum code (S1405: Yes), a curCode pixel is searched for with reference to the code image at curCCDX (S1406). It is checked whether a curCode pixel is present (S1407).

If a curCode pixel is present (S1407: Yes), a pixel having a code greater than curCode is searched for with reference to the code image at curCCDX (S1408). It is determined whether a pixel having a code greater than curCode is present (S1409).

If a pixel having a code greater than curCode is present (S1409: Yes), processing to determine the boundary with sub-pixel precision, which will be described later, is performed (S1410). curCode is incremented by “1” to obtain the boundary coordinates of the next curCode (S1411), and the processing from S1405 is repeated.

The boundary is present in the position of s pixel having curCode or the position of a pixel having a greater code. In the present embodiment, it is provisionally assumed that the boundary is in the position of a pixel having a code greater than curCode.

If curCode is not present (S1407: No), or if there is no pixel having a code greater than curCode (S1409: No), curCode is incremented by “1” to obtain the boundary coordinate with respect to the next curCode (S1411), and the processing from step S1405 is repeated.

The processes of steps S1405 to S1411 are repeated to each code of 0 to the maximum code. When curCode exceeds the maximum code (S1405: No), the detection position is changed by adding dCCDX to curCCDX (S1412). The processing from step S1403 is repeated for the new detection position.

When curCCDX exceeds the final coordinate (S1403), that is, when the detection with respect to each position from the initial coordinate to the final coordinate ends, the processing ends.

FIG. 15 is a flow chart of the processing for obtaining the code boundary coordinate with sub-pixel precision (S1410 in FIG. 14).

First, in this processing, all the luminance images having a change in brightness in the position of a pixel having a code greater than curCode detected in step S1409 in FIG. 14 are extracted (S1501) from the luminance images stored in the luminance image storage section 37 c in step S1221 of FIG. 12.

The mask pattern numbers of the extracted luminance images are stored in array PatID[], and the number of extracted luminance images is stored in noPatID (S1502). Array PatID[] and noPatID are stored in the ID storage section 37 f.

Counter “i” is initialized (S1503). It is checked whether the value of counter “i” is smaller than noPatID (S1504). If the value is smaller (S1504: Yes), a CCDY value of the boundary is obtained with respect to the luminance image having the mask pattern number of PatID[i] corresponding to counter “i”, and the value is stored in fCCDY[i] (S1505).

When the process of step S1505 ends, counter “i” is incremented by “1” (S1506), and the processing from step S1504 is repeated. If it is determined that the value of counter “i” is greater than noPatID (S1504: No), that is, when the process of step S1505 is completed for all the luminance images extracted in step S1501, the weighed average of fCCDY[i] obtained in the process of step S1505 is calculated, and the result is set as the boundary value (S1507).

Instead of the weighted average, the median value of fCCDY[i] obtained in the process of step S1505 may be calculated and set as the boundary value. The boundary value may also be calculated statistically.

The boundary coordinates are expressed by the coordinate of curCCDX and the weighed average obtained in step S1507. The boundary coordinates are stored in the code boundary coordinate storage section 37 e, and the processing ends.

FIG. 16 is a flow chart of processing for obtaining the CCDY value of the boundary with respect to the luminance image having a mask pattern number of PatID[i] (S1505 in FIG. 15).

First, the process expressed as ccdx=MAX(curCCDX−dx, 0), that is, the process for setting a greater value of “curCCDX−dx” and “0” as ccdx, is performed, and counter “j” is initialized (S1601).

To be more specific, “0” in step S1601 means the minimum CCDX value. If the curCCDX value of the current detection position is “1” and if a predetermined dx value is “2”, curCCDX−dx=−1 is smaller than the minimum CCDX value of “0”. The ccdx value is set to “0” for subsequent processes.

In other words, smaller positions below the minimum CCDX value are eliminated from the subsequent processes.

The dx value can be predetermined to any integer, including “0”. In the case shown in FIG. 13, dx is set to “2”, and the ccdx value is set to “curCCDX−2” according to the case shown in FIG. 13.

It is determined whether ccdx≦MIN(curCCDX+dx, ccdW−1) (S1602). The left side, MIN(curCCDX+dx, ccdW−1), means the smaller value of curCCDX+dx and the maximum value ccdW of the CCDX value minus 1. The value and the ccdx value are compared.

Positions greater than the maximum CCDX value are eliminated from the subsequent processes.

If ccdx is smaller than MIN(curCCDX+dx, ccdW−1) (S1602: Yes), the eCCDY value in the position of a pixel having a boundary is obtained with reference to the code image and the luminance image to which PatID[i] is assigned (S1603).

If the detection position is curCCDX−1 as shown in FIG. 13, pixel I is detected as a pixel that can have the boundary, and the eCCDY value is obtained in the position of pixel I.

Polynomial approximate expression Bt=fb(ccdy) with respect to luminance in the ccdy direction is obtained within the range of MAX(eCCDY−dy, 0)≦ccdy≦MIN(eCCDY+dy−1, ccdH−1), from the luminance image having a mask patter number of PatID[i] (S1604).

The ccdy value at the intersection of polynomial approximate expression Bt and luminance threshold bTh is obtained, and the value is stored in efCCDY[i] (S1605). The boundary coordinates can be detected with sub-pixel precision through steps S1604 and S1605.

Next, ccdx and counter “j” each are incremented by “1” (S1605), and the processing from step S1602 is repeated. The boundary is detected in each detection position with sub-pixel precision in the predetermined range about curCCDX to the right and left.

If it is determined that ccdx is greater than MIN(curCCDX+dx, ccdW−1) (S1602: No), polynomial approximate expression of ccdy=fy(ccdx) is obtained for efCCDY[i] calculated in the range of curCCDX−dx to CCDX+dx (S1606). This processing uses each value detected in step S1605, and the boundary coordinate detection can be performed with a higher precision than boundary coordinate detection in one detection position.

The intersection of the obtained polynomial approximate expression and curCCDX is specified as the CCDY value of the boundary with respect to the luminance image having a mask pattern number of PatID[i] (S1607), and the processing ends. As shown in the flow chart of FIG. 15, all the processing described above is carried out for each of the extracted luminance images, and the weighed average of the obtained boundary coordinates is obtained, and the result is used as the final boundary coordinate (S1507). Therefore, the precision of boundary coordinate detection can be improved further.

FIGS. 17(a) to 17(c) are views illustrating the lens aberration correction processing (S1224 in FIG. 12(c)). Because aberration of the imaging optical system 21 causes the incoming ray bundle to be deviated from a correct image formation position by an ideal lens, the lens aberration correction processing corrects the pixel position of the taken image to the correct position.

The aberration correction is on the basis of data obtained by calculating the aberration of the optical system, using half field angle “hfa”, which is an incident angle of light, as a parameter in the image taking range of the imaging optical system 21, as shown in FIG. 17(b).

The aberration correction processing is executed in accordance with the lens aberration correction program 36 f, with respect to the code boundary coordinates stored in the code boundary coordinate storage section 37 e, and the aberration-corrected data is stored in the aberration correction coordinate storage section 37 g.

To be more specific, the correction is made by using camera calibration functions (approximate expressions) of (1) to (3) below for converting coordinates (ccdx, ccdy) of a certain point in the real image to coordinates (ccdcx, ccdcy) in an ideal camera image.

In this case, aberration amount “dist” (%) is expressed by using half field angle “hfa” (deg) as dist=f(hfa). The focal length of the imaging optical system 21 is denoted as focallength (mm), the CCD pixel length is denoted as pixellength (mm), and the coordinates of the center of lens in the CCD 22 are denoted as (Centx, Centy). ccdcx=(ccdx−Centx)/(1+dist/100)+Centx   (1) ccdcy=(ccdy−Centy)/(1+dist/100)+Centy   (2) hfa=arctan[(((ccdx−Centx)²+(ccdy−Centy)²)^(0.5))×pixellength/focallength]  (3)

FIGS. 18(a) and 18(b) are views illustrating a method of calculating three-dimensional coordinates in a three-dimensional space from coordinates in the CCD space in the real space conversion processing based on triangulation (S1225 in FIG. 12(c)).

The real space conversion processing based on triangulation is executed in accordance with the triangulation calculation program 36 g, and the three-dimensional coordinates in the three-dimensional space of the aberration-corrected code boundary coordinates stored in the aberration correction coordinate storage section 37 g are obtained. The calculated three-dimensional coordinates are stored in the three-dimensional coordinate storage section 37 h.

In this embodiment, the coordinate system of the image input-and-output apparatus 1 with respect to original P curved in the horizontal image taking direction is formed by using the direction of the optical axis of the imaging optical system 21 as the Z axis, a point of VPZ away from the principal point of the imaging optical system 21 along the Z axis direction as the origin point, the horizontal direction with respect to the image input-and-output apparatus 1 as the X axis, and the vertical direction as the Y axis.

The angle of projection from the image projection section 13 to the three-dimensional space (X, Y, Z) is expressed as θp. The distance between the optical axis of the imaging optical system 21 and the optical axis of the image projection section 13 is expressed as D. The field of view of the imaging optical system 21 in the Y direction is from Yftop to Yfbottom. The field of view in the X direction is from Xfstart to Xfend. The length (height) of the CCD 22 in the Y-axis direction is expressed as Hc, and the length (width) in the X-axis direction is expressed as Wc. The angle of projection θp is given in accordance with the code assigned to each pixel.

The three-dimensional space position (X, Y, Z) corresponding to certain coordinates (ccdx, ccdy) in the CCD 22 can be obtained by solving five equations about a triangle formed by a point on the image forming plane of the CCD 22, the point of projection of pattern light, and a point intersecting the X-Y plane. Y=−(tanθp)Z+PPZ+tanθp−D+cmp(Xtarget)   (1) Y=−(Ytarget/VPZ)Z+Ytarget   (2) X=−(Xtarget/VP)Z+Xtarget   (3) Ytarget=Yftop−(ccdcy/Hc)×(Yftop−Yfbottom)   (4) Xtarget=Xfstart+(ccdcx/Wc)×(Xfend−Xfstart)   (5) In equation (1) above, cmp(Xtarget) is a function for correcting the difference between the imaging optical system 21 and the image projection section 13. In an ideal condition, without no difference, cmp(Xtarget) is assumed to be zero.

In the same way as described above, the relationship between certain coordinates (lcdcx, lcdcy) on the projection LCD 19 included in the image projection section 13 and three-dimensional coordinates (X, Y, Z) in the three-dimensional space can be expressed by equations (1) to (4) below.

In this case, the principal position of the image projection section 13 is expressed as (0, 0, PPZ). The field of view of the image projection section 13 in the Y direction is from Ypftop to Ypfbottom, and the field of view in the X direction is from Xpfstart to Xpfend. The length (height) of the projection LCD 19 in the Y-axis direction is expressed as Hp, and the length (width) in the X-axis direction is expressed as Wp. Y=−(Yptarget/PPZ)Z+Yptarget   (1) X=−(Xptarget/PPZ)Z+Xptarget   (2) Yptarget=Ypftop−(lcdcy/Hp)×(Xpftop−Xpfbottom)  (3) Xptarget=Xpfstart+(lcdcx/Wp)×(Xpfend−Xpfstart)   (4) By giving three-dimensional space coordinates (X, Y, Z) to the equations (1) to (4), LCD space coordinates (lcdcx, lcdcy) can be obtained from the equations. Therefore, for instance, an LCD device pattern for projecting a certain shape or letter into the three-dimensional space can be calculated.

FIG. 19 is a flow chart of the planar image processing (S611 in FIG. 6). When an image of curved original P as shown in FIG. 1 is taken or when an image of rectangular original is taken diagonally (the image becomes trapezoidal), for instance, the planer image processing obtains and displays a planar image as if taken from straight original P or taken perpendicularly.

First, in the processing, a high-resolution setting signal is sent to the CCD 22 (S1901), and a viewfinder image is displayed on the LCD monitor 10 (S1902).

The release button 8 is scanned (S1903 a) and it is determined whether the release button 8 is half-pressed (S1903 b). If the button is half-pressed (S1903 b: Yes), the autofocus (AF) function and the autoexposure (AE) function are activated to adjust the focus, aperture, and shutter speed (S1903 c). If the button is not half-pressed (S1903 b: No), the processing from step S1903 a is repeated.

The release button 8 is scanned again (S1903 d) to check whether the release button 8 is full-pressed (S1903 e). If the release button 8 is full-pressed (S1903 e: Yes), it is checked whether the flash mode is selected (S1903 f).

If the flash mode is selected (S1903: Yes), the flash 7 is fired (S1903 g), and the image is taken (S1903 h). If the flash mode is not selected (S1903 f: No), the image is taken without firing the flash 7 (S1903 h). If it is determined that the button is not full-pressed (S1903 e: No), the processing from step S1903 a is repeated.

Three-dimensional-shape detection processing which is the same as the three-dimensional-shape detection processing (S1006 in FIG. 10) is carried out, and the three-dimensional shape of the object is detected (S1906).

Original-posture calculation processing for obtaining the posture of original P is carried out (S1907), on the basis of the result of the three-dimensional shape detection obtained by the three-dimensional-shape detection processing (S1906). Through the processing, position L, angle θ, and curvature φ(x) of original P with respect to the image input-and-output apparatus 1 are calculated as posture parameters of original P.

On the basis of the calculated results, plane conversion processing, which will be described later, is performed (S1908), and a planar image of straight original P is generated even if the original is curved.

The planar image obtained by the plane conversion processing (S1908) is stored in the external memory 27 (S1909), and the planar image is displayed on the monitor LCD 10 (S1910).

It is checked whether the mode selected by the mode changeover switch 9 has been changed (S1911). If no change is found (S1911: Yes), the processing from step S702 is repeated. If a change is found (S1911: No), the processing ends,

FIGS. 20(a) to 20(c) are views illustrating the original-posture calculation processing (S1907 of FIG. 19). Suppose that the curvature of original P is uniform in the y direction. First, in the original-posture calculation processing, two curves are obtained by regression curve approximation of two rows of points in the three-dimensional space position, from the coordinate data concerning the code boundary stored in the three-dimensional coordinate storage section 37 h, as shown in FIG. 20(a).

The curves can be obtained from the positional information of an upper quarter and a lower quarter of the projection range of pattern light (boundary between codes 63 and 64 and boundary between codes 191 and 192), for instance.

Suppose there is a straight line connecting points of “0” of the two curves in the X-axis direction and that the point of intersection of the straight line and the Z-axis, that is the point of intersection of the optical axis and original P is expressed as position (0, 0, L) of original P in the three-dimensional space. The angel formed by the straight line and the X-Y plane is expressed as inclination θ of original P about the X-axis.

As shown in FIG. 20(b), rotational transform of original P is carried out by inclination θ about the X-axis in the reverse direction. That is, original P brought to be parallel to the X-Y plane is assumed.

As shown in FIG. 20(c), a displacement in the Z-axis direction in the cross section of original P in the X-Z plane can be expressed as a function of X, or curvature φ(X). Position L, angle θ, and curvature φ(X) of original P are calculated as the parameters of the original posture, and the processing ends.

FIG. 21 is a flow chart of the plane conversion processing (S1908 in FIG. 19). In this processing, first, the area of the processing is assigned to the working area 371 of the RAM 37, and the variable of counter “b” used in this processing is set to the initial value (b=0) (S2101).

Based on position L, inclination θ, and curvature φ(x) of original P calculated by the original-posture calculation program 36 h, a rectangular area is formed by points obtained by turning points of four comers of the image without pattern light stored in the image-without-pattern-light storage section 37 b by—L in the Z-axis direction and by −θ about the X-axis and carrying out inverse transform of transforming into curvature φ(x) (processing equivalent to curvature processing, which will be described later) (rectangular area of an image of the text side of original P observed in an approximately perpendicular direction), and the number of pixels included in the rectangular area is obtained (S2102).

The coordinates on the image without pattern light corresponding to each pixel forming the specified rectangular area are obtained, and the pixel information of each pixel of a planar image is specified from the pixel information around the coordinates.

First, it is determined whether counter “b” reaches the number of pixels “a” (S2103). If counter “b” does not reach the number of pixels “a” (S2103: No), the curvature calculation processing is performed to rotational-transfer one pixel in the rectangular area by curvature φ(x) about the Y-axis (S2104). Rotational transfer of inclination θ about the X-axis is performed (S2105), and a movement is made in the Z-axis direction by distance L (S2106).

From the obtained position in the three-dimensional space, coordinates (ccdcx, ccdcy) on the CCD image taken by an ideal camera are obtained by an inverse function of triangulation (S2107). Coordinates (ccdx, ccdy) on the CCD image taken by a real camera are obtained by an inverse function of the camera calibration in accordance with the aberration characteristics of the imaging optical system 21 used (S2108). The state of the pixel in the corresponding position of the image without pattern light is obtained and stored in the working area 371 of the RAM 37 (S2109).

Counter “b” is incremented by “1” (S2110) to execute the processing from step S2103 to step S2109 with respect to the next pixel.

The processing of from step S2104 to step S2110 is repeated until counter “b” reaches the number of pixels “a” (S2103: Yes). The processing area assigned to the working area 371 for the processing is released (S2111), and the processing ends.

FIG. 22(a) is a view illustrating an overview of the curvature processing (S2104 in FIG. 21), and FIG. 22(b) is a view illustrating a planar image of original P formed by the plane conversion processing (S1908 in FIG. 19). The curvature processing is described in detail in “Imaging a Curved Document by Eye Scanner,” Transactions DII of the Institute of Electronics, Information and Communication Engineers, Vol. J86-D2 No. 3, p. 409.

Curvature Z=φ(x) is expressed as a polynomial approximate expression obtained when the method of least squares is applied to the sectional shape of the three-dimensional shape formed by obtained code boundary coordinate array (real space), cut by a plane of certain Y value parallel to the XZ plane.

When a curved face is converted to a flat face, a point in the flat face corresponding to a point on Z=φ(x) is associated with the length of the curve from Z=φ(0) to Z=φ(x).

When the image of curved original P as shown in FIG. 1 is taken, a planar image as shown in FIG. 22(b) can be obtained with the plane conversion processing, including the curvature processing. With the planar image, precision of OCR processing can be improved. Text and graphics on the original can be clearly recognized through the image.

FIGS. 23(a) and 23(b) are views illustrating a group of light-source lenses 50, as another example of the light-source lens 18 in the embodiment described earlier. FIG. 23(a) is a side view showing the light-source lenses 50, and FIG. 23(b) is a plan view showing the light-source lenses 50. Components identical to those in the embodiment described above will be denoted by the same reference symbols, and a description of the components will be omitted.

The light-source lens 18 in the embodiment described above includes convex aspheric lens sections 18 a integrally arranged on the base 18 b, aligned with the LEDs 17. In the case shown in FIGS. 23(a) and 23(b), bullet-shaped plastic lenses containing one LED 17 each are separately provided.

The separate light-source lenses 50 containing one LED 17 each allows each LED 17 and the corresponding light-source lens 50 to be positionally determined in one-to-one relationship. The relative position precision can be improved, and the direction of outgoing light can be aligned.

In contrast, when the entire lens array is positioned on the substrate 16, the direction of outgoing light can vary because of a positioning error occurring in die-bonding of the LEDs 17 or a difference in linear expansion coefficient between the lens array and the substrate.

Light coming from the LEDs 17 and projected onto the face of the projection LCD 19 is aligned to the normal to the face of the projection LCD 19 and can pass the diaphragm of the projection optical system 20 evenly. Accordingly, variations in illumination of the projected image can be suppressed, and a high-quality image can be projected as a result. The LED 17 contained in each light-source lens 50 is mounted to the substrate 16 through an electrode 51 having a lead and a reflector.

A frame-shaped elastic fixture member 52 is disposed around one group of light-source lenses 50 and binds the light-source lenses 50 into a certain direction. The fixture member 52 is made from a resinous material such as rubber, plastics, or the like.

Because the light-source lenses 50 are separately formed for the LEDs 17, it is hard to dispose them so that the angles of optical axes formed by the convex tips of the light-source lenses 50 are correctly aligned to the projection LCD 19.

In the case shown in FIGS. 23(a) and 23(b), the fixture member 52 surrounds one group of light-source lenses 50 to bring the outer surfaces of the light-source lenses 50 into contact one another and to bring the light-source lenses 50 into such positions that the optical axis of each light-source lens 50 meets the projection LCD 19 at a correct angle. This configuration allows each light-source lens 50 to project almost perpendicular light onto the projection LCD 19. Because the evenly perpendicular light can be projected onto the face of the projection LCD 19 and can pass the diaphragm of the projection lens evenly, variations in illumination of the projected image can be suppressed. A higher-quality image can be projected.

The fixture member 52 may have certain rigidity predetermined for a certain size. Alternatively, the fixture member 52 may be formed by an elastic material to bring the light-source lenses 50 into certain positions with the elasticity.

FIGS. 24(a) and 24(b) are views illustrating a fixture member 60, as another example different from the fixture member 52 for bringing the light-source lenses 50 into certain positions as shown in FIGS. 23(a) and 23(b). FIG. 24(a) is a perspective view showing a fixed state of the light-source lenses 50, and FIG. 24(b) is a partial section view of the state. Components identical to those described earlier will be denoted by the same symbols, and a description of the components will be omitted.

The fixture member 60 is formed as a flat plate having a through hole 60 a conically shaped along the outer surface of each light-source lens 50 in its sectional view. Each light-source lens 50 is fixed when it is inserted into the through hole 60 a.

An elastic exertion plate 61 is inserted between the fixture member 60 and the substrate 16, and an elastic O-ring 62 is disposed between the exertion plate 61 and the bottom of each light-source lens 50 in such a manner that the ring encircles the electrode 51.

The LED 17 contained in the light-source lens 50 is mounted to the substrate 16 through the electrode 51 passing through the through hole made in the exertion plate 61 and the substrate 16.

The fixture member 60 fixes each light-source lens 50 in the corresponding through hole 60 a having a cross-sectional shape along the outer surface of the lens, so that the optical axis of the light-source lens 50 can be directed to the projection LCD 19 at a correct angle more definitely than when the fixture member 50, described above, is used.

In the assembly process, the LEDs 17 can be fixed to correct positions by a force exerted by the O-rings 62.

A shock that can occur when the apparatus 1 is transported or the like can be absorbed by the elasticity of the O-ring 62. Accordingly, misalignment of the light-source lenses 50 due to the shock, disabling the light-source lenses 50 to direct perpendicular light onto the projection LCD 19, can be avoided.

In this embodiment, the processes of steps S1211 and S1215 in FIG. 12(b) can be associated with an imaging means, an imaging process, or an imaging step. The process of step S1221 in FIG. 12(c) can be associated with a luminance image generation means, a luminance image generation process, or a luminance image generation step. The process of step S1222 in FIG. 12(c) can be associated with a code image generation means, a code image generation process, or a code image generation step. The processing of step S1006 in FIG. 10 can be associated with a three-dimensional-shape calculation means, a three-dimensional-shape calculation process, or a three-dimensional-shape calculation step.

The process of step S1408 in FIG. 14 can be associated with a first-pixel detection means, a first-pixel detection process, or a first-pixel detection step. The process of step S1501 in FIG. 15 can be associated with a luminance image extraction means, a luminance image extraction process, or a luminance image extraction step. The processes of step S1603 and a part of step S1604 can be associated with a pixel area determination means, a pixel area determination process, or a pixel area determination step. The process of another part of step S1604 in FIG. 16 can be associated with an approximate expression calculation means, an approximate expression calculation process, or an approximate expression calculation step. The processes of steps S1505 and S1507 in FIG. 15 can be associated with a boundary coordinate calculation means, a boundary coordinate calculation process, or a boundary coordinate calculation step.

The present invention has been described in accordance with the embodiment, but the present invention is not limited to the embodiment. It can be easily inferred that a variety of modifications are possible unless it deviates from the scope of the present invention.

In the present embodiment, a planar image is obtained and displayed in the planar image mode, but a commonly-known OCR function may be incorporated to read a planar image. In that case, text on the planar image can be read with higher precision than when the curved document is read by the OCR function.

In step S1501 of FIG. 15 of the embodiment, all luminance images including a change in brightness are extracted and provisional CCDY values are obtained for all the images, but all the luminance images do not need to be extracted always. One or more images should be extracted, but the number of images is not limited. If the number of images to be extracted is reduced, the boundary coordinates can be obtained quickly.

In step S1507 of FIG. 15 of the embodiment, a weighed average of fCCDY[i] is obtained. In step S1607 of FIG. 16, values are averaged by using a polynomial approximate expression of efCCDY[i]. The average of the values can be obtained in other methods. A simple average of the values may be obtained. The median value of the values may be obtained. An approximate expression of the values may be calculated to specify a position detected by the approximate expression as a boundary coordinate. A statistical calculation may also be made.

In one embodiment of the present invention, the boundary coordinates of the code of interest detected by the boundary coordinate detection unit may be calculated with a resolution higher than the resolution of the imaging unit.

The boundary coordinates of the code of interest detected by the boundary coordinate defection unit or the boundary coordinate detection process configured as described above is calculated with a resolution (sub-pixel precision) higher than the resolution of the imaging unit or imaging process, so that the three-dimensional shape of the object can be calculated with high precision.

In one embodiment of the present invention, the pixel area determination unit can determine the pixel area from one or more successive rows of pixels starting from a row of pixels including the first pixel, in addition to the row of pixels including the first pixel, with reference to the code image. The approximate expression calculation unit may calculate an approximate expression for each row of pixels in the pixel area. The boundary coordinate—detection unit may calculate a position having a certain luminance threshold for each approximate expression and may detect the boundary coordinates of the code of interest from the result of calculation.

A position having a certain threshold is calculated for each of the two or more approximate expressions calculated from the two or more rows of pixels in such a configuration, so that the boundary coordinates can be detected with a precision higher than the precision with which the boundary coordinates are obtained from one approximate expression. Accordingly, the three-dimensional shape of the object can be calculated with higher precision.

In one embodiment of the present invention, the luminance image extraction unit may extract one or more luminance images. The pixel area determination unit may determine a pixel area with reference to a code image of each extracted luminance image. The approximate expression calculation unit may calculate an approximate expression for each row of pixels in the pixel area detected from each extracted luminance image. In this case, the boundary coordinate detection unit may calculate a position having a certain luminance threshold for each approximate expression to detect the boundary coordinates of the code of interest from the result of calculation.

A position having a certain threshold is calculated for each of the two or more approximate expressions in accordance with two or more extracted luminance images in such a configuration, so that the boundary coordinates can be detected with higher precision than when the boundary coordinates are obtained with one approximate expression. Accordingly, the three-dimensional shape of the object can be calculated with higher precision.

In one embodiment of the present invention, the luminance image extraction unit may extract one or more luminance images. The pixel area determination unit may determine a pixel area from one or more successive rows of pixels starting from the row of pixels containing the first pixel, besides the row of pixels containing the first pixel, with reference to a code image of each extracted luminance image. The approximate expression calculation unit may calculate an approximate expression for each row of pixels in the pixel area, for each extracted luminance image. In this case, the boundary coordinate detection unit may calculate a position having a certain luminance threshold for each approximate expression to detect the boundary coordinates of the code of interest from the result of calculation, for each of the extracted luminance images.

A position having a certain threshold is calculated for each of the four or more approximate expressions calculated from the two or more rows of pixels, for each of the two or more extracted luminance images, in such a configuration, so that the boundary coordinates can be detected with higher precision than when the boundary coordinates are obtained by using one approximate expression. Accordingly, the three-dimensional shape of the object can be calculated with higher precision.

In one embodiment of the present invention, the boundary coordinate detection unit may calculate a weighed average or the median value of positions calculated for all approximate expressions to detect the boundary coordinates of the code of interest from the result of calculation.

In such a configuration, the boundary coordinate detection unit or the boundary coordinate detection process calculates the weighed average or median value of the positions calculated for all the approximate expressions to detect the boundary coordinates of the code of interest from the result of calculation. Accordingly, just simple calculation should be added, and a load on the calculation device can be reduced, and the processing can be sped up.

In one embodiment of the present invention, the boundary coordinate detection unit may calculate an approximate expression for positions calculated by all approximate expressions to detect the boundary coordinates of the code of interest from the result of calculation.

In such a configuration, the boundary coordinate detection unit or the boundary coordinate detection process calculates an approximate expression for the positions calculated by all approximate expressions to detect the boundary coordinates of the code of interest from the result of calculation. Accordingly, the three-dimensional shape can be calculated with higher precision than when the weighed average or the median value is calculated.

In one embodiment of the present invention, the boundary coordinate detection unit may calculate an approximate expression for positions calculated by all approximate expressions for each extracted luminance image, calculate the boundary coordinate of the code of interest from the result of calculation, calculate a weighed average or the median value of the boundary coordinates of the code of interest calculated for each extracted luminance image, and detect the boundary coordinates of the code of interest from the result.

In such a configuration, the boundary coordinate detection unit calculates an approximate expression for the positions calculated by all the approximate expressions for each extracted luminance image, calculates the boundary coordinate of the code of interest from the result of calculation, calculates the weighed average or median value of the boundary coordinates of the code of interest calculated for each extracted luminance image, and detects the boundary coordinates of the code of interest from the result. Accordingly, just simple calculation should be added, and a load on the calculation device can be reduced, and the processing can be sped up. 

1. A three-dimensional-shape detection apparatus comprising: a projection unit that projects a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series; an imaging unit that takes an image of the object onto which each pattern light is projected by the projection unit; a luminance image generation unit that generates a plurality of luminance images by calculating the luminance of each pixel from the image taken by the imaging unit; a code image generation unit that generates a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images generated by the luminance image generation unit with respect to a certain threshold; a three-dimensional-shape calculation unit that calculates the three-dimensional shape of the object by utilizing the code image generated by the code image generation unit; a first-pixel detection unit that detects a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image; a luminance image extraction unit that extracts a luminance image having a light-dark boundary in a position corresponding to the first pixel detected by the first-pixel detection unit, from the plurality of luminance images; a pixel area determination unit that determines a pixel area that includes a pixel in a certain area adjacent to the first pixel; an approximate expression calculation unit that calculates an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area determined by the pixel area determination unit; and a boundary coordinate detection unit that calculates a position having a certain luminance threshold in the approximate expression calculated by the approximate expression calculation unit and detecting the boundary coordinates of the code of interest in accordance with the result of calculation, wherein the three-dimensional-shape calculation unit calculates the three-dimensional shape of the object in accordance with the boundary coordinates detected by the boundary coordinate detection unit by using the code image.
 2. The three-dimensional-shape detection apparatus according to claim 1, wherein the boundary coordinates of the code of interest, detected by the boundary coordinate detection unit, are calculated with a resolution higher than the resolution of the imaging unit.
 3. The three-dimensional-shape detection apparatus according to claim 1, wherein the pixel area determination unit determines the pixel area from one or more successive rows of pixels starting from the row of pixels including the first pixel, besides the row of pixels including the first pixel, with reference to the code image; the approximate expression calculation unit calculates the approximate expression for each row of pixels in the pixel area; and the boundary coordinate detection unit calculates a position having a certain luminance threshold for each approximate expression and detects the boundary coordinates of the code of interest from the result of calculation.
 4. The three-dimensional-shape detection apparatus according to claim 1, wherein the luminance image extraction unit extracts one or more luminance images that include the luminance image; the pixel area determination unit determines the pixel area for each extracted luminance image, with reference to the code image; the approximate expression calculation unit calculates the approximate expression for each row of pixels in the pixel area detected from each extracted luminance image; and the boundary coordinate detection unit calculates a position having a certain luminance threshold for each approximate expression and detects the boundary coordinates of the code of interest from the result of calculation.
 5. The three-dimensional-shape detection apparatus according to claim 1, wherein the luminance image extraction unit extracts one or more luminance images that include the luminance image; the pixel area determination unit determines the pixel area for each extracted luminance image from one or more successive rows of pixels starting from the row of pixels containing the first pixel, besides the row of pixels containing the first pixel, with reference to the code image; the approximate expression calculation unit calculates the approximate expression for each row of pixels in the pixel area for each extracted luminance image; and the boundary coordinate detection unit calculates a position having a certain luminance threshold for each approximate expression for each extracted luminance image and detects the boundary coordinates of the code of interest from the result of calculation.
 6. The three-dimensional-shape detection apparatus according to claim 3, wherein the boundary coordinate detection unit calculates a weighed average or the median value of positions calculated for the approximate expressions and detects the boundary coordinates of the code of interest from the result of calculation.
 7. The three-dimensional-shape detection apparatus according to claim 3, wherein the boundary coordinate detection unit calculates an approximate expression of positions calculated for the approximate expressions and detects the boundary coordinates of the code of interest from the result of calculation.
 8. The three-dimensional-shape detection apparatus according to claim 5, wherein the boundary coordinate detection unit calculates an approximate expression of positions calculated for the approximate expressions in each extracted luminance image, calculates the boundary coordinates of the code of interest from the result of calculation, calculates a weighed average or the median value of the boundary coordinates of the code of interest calculated in the extracted luminance images, and detects the boundary coordinates of the code of interest from the result.
 9. A three-dimensional-shape detection method comprising: a projection step of projecting a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series; an imaging step of taking an image of the object onto which each pattern light is projected in the projection step; a luminance image generation step of generating a plurality of luminance images by calculating the luminance of each pixel from each image taken in the imaging step; a code image generation step of generating a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images generated in the luminance image generation step with respect to a certain threshold; a three-dimensional-shape calculation step of calculating the three-dimensional shape of the object by utilizing the code image generated in the code image generation step; after the code image generation step, a first-pixel detection step of detecting a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image; a luminance image extraction step of extracting a luminance image having a light-dark boundary in a position corresponding to the first pixel detected in the first-pixel detection step, from the plurality of luminance images; a pixel area determination step of determining a pixel area that includes a pixel in a certain area adjacent to the first pixel; an approximate expression calculation step of calculating an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area determined in the pixel area determination step; and a boundary coordinate detection step of calculating a position having a certain luminance threshold in the approximate expression calculated in the approximate expression calculation step and detecting the boundary coordinates of the code of interest in accordance with the result of calculation, wherein the three-dimensional-shape calculation step calculates the three-dimensional shape of the object in accordance with the boundary coordinates detected in the boundary coordinate detection step by using the code image.
 10. A computer usable medium having computer readable instructions stored thereon, which, when executed by a computer, are configured to: project a plurality of types of pattern lights formed of a series of alternate light and dark patterns, onto an object in a time series; take an image of the object onto which each pattern light is projected; generate a plurality of luminance images by calculating the luminance of each pixel from the taken image; generate a code image having certain codes assigned to the pixels in accordance with a result of threshold processing of the plurality of luminance images with respect to a certain threshold; calculate the three-dimensional shape of the object by utilizing the code image; detect a first pixel that is adjacent to a pixel having a code of interest and that has a code different from the code of interest, in a detection position in a direction crossing the pattern light in the code image; extract a luminance image having a light-dark boundary in a position corresponding to the first pixel, from the plurality of luminance images; determine a pixel area that includes a pixel in a certain area adjacent to the first pixel; calculate an approximate expression that expresses a change in luminance in the extracted luminance image in the pixel area; and calculate a position having a certain luminance threshold in the approximate expression and detecting the boundary coordinates of the code of interest in accordance with the result of calculation, wherein the three-dimensional shape of the object is calculated in accordance with the boundary coordinates detected by using the code image. 